package org.qq.tv.web.task;



import org.qq.tv.web.service.UpDateService;

import java.sql.Time;

/**
 * 线程任务类
 */
public abstract class Task implements Runnable {
    //更新数据存储对象
    private Date d = null;
    //数据更新服务
    private UpDateService ups = null;

    public Task(UpDateService up, Date date) {
        this.ups = up;
        this.d = date;
    }

    public final static Date newDate(Date date) {
        Date d = new Date();
        d.setVideoGroupId(date.getVideoGroupId());
        d.setGroupItemId(date.getGroupItemId());
        d.setName(date.getName());
        d.setHtmlweb(date.getHtmlweb());

        return d;
    }

    @Override
    public void run() {
        //任务类型 判断
        switch (this.d.getTaskTyep()) {
            case Date.ADD_VIDEO_HTML:
                //添加视频 html 路径
                this.addVideoHtml();
                break;
            case Date.UP_VIDEO_HTML:
                _VIDEO_HTML:
                //更新视频 html 路径
                this.upVideoHtml();
                break;
        }
    }

    /**
     * 更新视频 html 路径
     */
    public void upVideoHtml() {
    }

    /**
     * 添加视频 html 路径
     */
    private void addVideoHtml() {
    }

    /**
     * 任务数据
     */
    public static class Date {
        //任务类型
        public final static int addweb = 1;//网站添加
        public final static int addGroup = 2;//网站 视频 分组
        public final static int paginfCount = 3;//网站 视频 分组条目页面数量
        public final static int videoItem = 4;//视频 条目
        public final static int videoMessage = 5;//视频 视频信息
        public final static int ADD_VIDEO_HTML = 6;//添加视频 html 路径
        public final static int UP_VIDEO_HTML = 7;//更新视频 html 路径
        public final static int upDate = 10;//网站 视频 数据
        private int taskTyep = 0;//任务类型

        private Integer id = 0;
        private Integer videoGroupId = 0;
        private Integer groupItemId = 0;
        private String name = null;
        private String uptime = null;
        private Time playitmp = null;
        private Integer playcont = 0;
        private String itemhtml = null;//html 条目路径
        private String imagepath = null;
        private String htmlweb = null;
        private String httpmp4 = null;
        private String playm3u8 = null;

        public Integer getId() {
            return id;
        }

        public void setId(Integer id) {
            this.id = id;
        }

        public Integer getVideoGroupId() {
            return videoGroupId;
        }

        public void setVideoGroupId(Integer videoGroupId) {
            this.videoGroupId = videoGroupId;
        }

        public Integer getGroupItemId() {
            return groupItemId;
        }

        public void setGroupItemId(Integer groupItemId) {
            this.groupItemId = groupItemId;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getUptime() {
            return uptime;
        }

        public void setUptime(String uptime) {
            this.uptime = uptime;
        }

        public Time getPlayitmp() {
            return playitmp;
        }

        public void setPlayitmp(Time playitmp) {
            this.playitmp = playitmp;
        }

        public Integer getPlaycont() {
            return playcont;
        }

        public void setPlaycont(Integer playcont) {
            this.playcont = playcont;
        }

        public String getItemhtml() {
            return itemhtml;
        }

        public void setItemhtml(String itemhtml) {
            this.itemhtml = itemhtml;
        }

        public String getImagepath() {
            return imagepath;
        }

        public void setImagepath(String imagepath) {
            this.imagepath = imagepath;
        }

        public String getHtmlweb() {
            return htmlweb;
        }

        public void setHtmlweb(String htmlweb) {
            this.htmlweb = htmlweb;
        }

        public String getHttpmp4() {
            return httpmp4;
        }

        public void setHttpmp4(String httpmp4) {
            this.httpmp4 = httpmp4;
        }

        public String getPlaym3u8() {
            return playm3u8;
        }

        public void setPlaym3u8(String playm3u8) {
            this.playm3u8 = playm3u8;
        }

        public int getTaskTyep() {
            return taskTyep;
        }

        public void setTaskTyep(int taskTyep) {
            this.taskTyep = taskTyep;
        }
    }
}
